if quarkx.openconfigdlg("Customize %s menu" % gamename, group, [newsep, newitem]):
for i in range(ud.itemcount-1, -1, -1):
ud.removeitem(i)
for ci in group.subitems:
p = quarkx.newobj("item:")
p.copyalldata(ci)
p["Form"] = None
p["Txt"] = ci.shortname
ud.appenditem(p)
editor.initmenu(quarkx.clickform)
file.savefile()
def loadLeakFile(m):
import mapholes
mapholes.LoadLinFile(m.editor, m.auxfilename)
leakMenuItem = qmenu.item("Load Leak&file",loadLeakFile,hint="|Loads the leak file, if there is one.\n\nYou are responsible for making sure that the leak file actually belongs to the map you're working on (the build tools will delete previous leak files after a successful compile, but it is still possible to get confused, if you start a new map with the same name as an older one with a leak).\n\nThe thickness of the 'Leak line' that will be drawn can be changed by going to the 'Options' menu and selecting the 'Set Line Thickness' function.|intro.mapeditor.menu.html#gamemenu")
portalsMenuItem = qmenu.item("Load Portal&file",loadPortalFile,hint="|Loads the portals file, if there is one.\n\nWhat the blue lines indicate is the 'windows' between the convex ('leaf nodes') that the bsp process carves the visible spaces of your map into. So you can investigate the effects of using detail and hint-brushes, etc to make your map more efficient and run better.\n\nYou are responsible for making sure that the portals (probably .prt) file actually belongs to the map you're working on, and are up-to-date.|intro.mapeditor.menu.html#gamemenu")
def prepAuxFileMenuItem(item,extkey,defext):
editor=item.editor
mapfileobject = editor.fileobject
map = checkfilename(mapfileobject["FileName"] or mapfileobject.shortname).lower()
mapfilename = quarkx.outputfile('')+'maps\\'+map
auxextension = quarkx.setupsubset()[extkey]
if not auxextension:
auxextension=defext
auxfilename = mapfilename+auxextension
if quarkx.getfileattr(auxfilename)==FA_FILENOTFOUND:
brushnumsMenuItem = qmenu.item("Select Brush Number",BrushNumClick,"|Select Brush Number:\n\nTries to find brushes by number, as specified in compile tool error messages (the use of duplicators, etc. might subvert this).\n\nSee the infobase for more detailed explanations on how to use this function.|maped.builderrors.console.html")
def onclick(m):
for args in ((leakMenuItem,"MapHoles",".lin"),
(portalsMenuItem,"MapPortals",".prt"),
(brushnumsMenuItem,"MapFileExt",".map"), # this options keyword doesn't exist
):
apply(prepAuxFileMenuItem,args)
def QuakeMenu(editor):
"The Quake menu, with its shortcuts."
# this menu is read from UserData.qrk.
items = []
sc = {}
isbsp = "Bsp" in editor.fileobject.classes # some items don't apply for BSP files
gamename = quarkx.setupsubset().shortname
#firstcmd = FirstBuildCmd()
sourcename = "UserData %s.qrk" % gamename
ud = LoadPoolObj(sourcename, quarkx.openfileobj, sourcename)
ud = ud.findname("Menu.qrk")
if ud is not None:
for p in ud.subitems:
txt = p["Txt"]
if txt=="-":
items.append(qmenu.sep)
else:
m = qmenu.item(txt, qmenuitem1click, "|The commands in this menu lets you run your map with the game. The most common commands are the first few ones, which lets you try your map as a one-step operation.\n\nBefore a map can be played, it must be compiled (translated into a .bsp file). This is done by other programs that QuArK will call for you. See the Configuration dialog box, under the page of the game you wish to map for, where you must tell QuArK where these build programs are installed. The programs themselves are available in Build Packs, one for each game you want to make maps for, and that can be downloaded from http://dynamic.gamespy.com/~quark/.|intro.mapeditor.menu.html#gamemenu")
m.info = p
#if isbsp and p[firstcmd]:
# m.state = qmenu.disabled
#elif p["Shortcut"]:
if p["Shortcut"]:
sc[p["Shortcut"]] = m
items.append(m)
items.append(qmenu.sep)
for item in (leakMenuItem, portalsMenuItem, brushnumsMenuItem):
item.editor=editor
items.append(item)
items.append(qmenu.sep)
items.append(qmenu.item("&Customize menu...", Customize1Click, "customizes this menu"))